import 'package:hello/douban/modal/home.dart';
import 'package:hello/douban/service/http_request.dart';

import '../config.dart';

class HomeRequest {
  static Future<List<MovieItem>> getMovieList(int start) async {
    final movieUrl = "/j/search_subjects?type=movie&tag=豆瓣高分&sort=rank&page_limit=$MOVIECOUNT&page_start=$start";
    final result = await HttpRequest.request(movieUrl,method: "GET");
    final subjects = result["subjects"];
    List<MovieItem> movies = [];
    for(var sub in subjects) {
      movies.add(MovieItem.fromJson(sub));
    }
    return movies;
  }
}